import 'package:flutter/material.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:xinxuan/common/appbar_util.dart';
import 'package:xinxuan/common/button_util.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:xinxuan/common/scroll_configuration_common.dart';
import 'package:xinxuan/controllers/my_controller/upgrades_page_controller.dart';
import 'package:xinxuan/utils/color_util.dart';

class UpgradesPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return GetBuilder<UpgradesPageController>(
      init: UpgradesPageController(),
      builder: (controller) {
        return Scaffold(
          backgroundColor: pageBgColor,
          appBar: AppBarUtil(
            title: '会员升级',
            backgroundColor: bgWhiteColor,
          ),
          body: ScrollConfigurationCommon(child: ListView(
            children: [
              Container(
                height: 65.h,
                alignment: Alignment.center,
                child: Text(
                  '特别提示',
                  style: TextStyle(
                    color: textBlackColor,
                    fontSize: 16.sp,
                    fontWeight: FontWeight.bold
                  ),
                ),
              ),
              Container(
                padding: EdgeInsets.symmetric(horizontal: 20.w),
                margin: EdgeInsets.only(bottom: 20.h),
                child: Text(
                  '您正在进行从魔法星选体验空间会员升级为VIP抢购会员的操作，在此特别提示您：如若您成功从体验空间抢购会员升级为VIP抢购会员，您将无法再降至体验空间抢购会员，且不能再参与体验空间抢购会员的抢购活动。如您继续进行升级操作，请备注升级理由并提交升级申请供平台审核。您承诺此升级操作是您本人的真实意思表示，并愿意承担升级后的责任和义务。',
                  style: TextStyle(
                    color: textBlackColor,
                    fontSize: 14.sp
                  ),
                ),
              ),
              Container(
                padding: EdgeInsets.symmetric(horizontal: 16.w),
                child: Container(
                  decoration: BoxDecoration(
                    color: bgWhiteColor,
                    borderRadius: BorderRadius.circular(5.w)
                  ),
                  padding: EdgeInsets.all(16.w),
                  child: TextField(
                    controller: TextEditingController(text: controller.reason.value),
                    decoration: InputDecoration(
                      border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.transparent)),
                      enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.transparent)),
                      focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.transparent)),
                      contentPadding: EdgeInsets.zero,
                      counterText: '',
                      hintText: '会员申请请输申请理由',
                      hintStyle: TextStyle(
                        fontSize: 14.sp,
                        color: textSubtitleColor,
                      )
                    ),
                    maxLines: 9,
                    maxLength: 190,
                    cursorColor: textSubtitleColor,
                    style: TextStyle(
                      fontSize: 14.sp,
                      color: textSubtitleColor
                    ),
                    onChanged: (String value) {
                      controller.reason.value = value;
                    },
                  ),
                ),
              )
            ],
          )),
          bottomNavigationBar: BottomAppBar(
            elevation: 0,
            child: Container(
              height: 56.h,
              alignment: Alignment.center,
              padding: EdgeInsets.symmetric(horizontal: 12.w),
              child: ButtonUtil(
                text: '确定', 
                fontSize: 14.sp, 
                borderRadius: 30.w, 
                height: 36.h, 
                onTop: () {
                  controller.submitUpgrades();
                }
              ),
            ),
          ),
        );
      },
    );
  }
}